-
Notifications
You must be signed in to change notification settings - Fork 537
StackLattice
implementation
#2021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
NonuniformStackLattice
implementationStackLattice
implementation
The uniform case is correct, but the nonuniform case should be Note that this is because my current implementation does not catch the case where a non-iterable pitch is set for a non-uniform stack lattice. I'm working on a solution to this. UPDATE: Commit 2bff4cc fixes the implementation and now catches errors when setting |
I did some more poking around today and realized that the |
This is a pretty big PR so I think 2 or 3 reviewers would be ideal @paulromano @pshriwise @anyone else who wants to review |
Thanks @yardasol for this PR! I'm definitely planning on reviewing this and would appreciate getting @pshriwise's input too. I unfortunately have to plead with you to be patient. We're in the midst of preparing for our 4-day OpenMC course next week, hence the pileup of unreviewed PRs. Once things are all set for the course, we should be able to start handling a lot of the PRs, including this one. |
Hi @paulromano, I apologize for the frequent pinging. I don't expect anyone to review PRs immediately when I tag them, so I'm a bit embarrassed that I came off in that way! I'll try to be more suave about that. I pinged you and Patrick because this PR has been sitting in draft mode for weeks now and I just wanted to make sure you knew it existed :). Good luck with the course next week! |
@yardasol I apologize that I haven't gotten you a full review on this yet. This is quite an impressive PR! But, it's also a big one that has some design implications so I need a bit of time to work through it and also try out the feature as well so I can better understand it. I just wanted you to know I haven't forgotten it 😄 If you happen to be free tomorrow at 9am CT and are up for it, it would be great if you could join our OpenMC monthly meet-up and walk through an example with the stack lattice feature. |
Hi @paulromano. Yes this PR is quite large. I appreciate you taking the time to go through it. What fortuitous timing for the monthly meet-up; I'd be happy to swing by and go through a notebook example with everyone. Update: So, I decided to go with bit more sophisticated of a model for the example I want to show (a toy BWR fuel rod). Turns out that this contribution isn't ready at all in the way I've implemented it. The toy BWR fuel rod model is giving me bunch of particle not found errors again. Here's my hypothesis: I'm thinking about how to allow users to specify a bound on their lattice in the unbounded dimensions. Perhaps an attribute Even though I realize this is now not working as intended, I think I'll still show up to the meeting tomorrow anyways so I can get ideas and feedback from folks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for proposing this feature @yardasol! I've had a chance to look into the implementation a little bit more and do feel that the right path forward is to try to extend our current RectLattice
class to support a one-dimensional lattice (as we discussed on the last monthly meeting call). The only case that won't cover is the non-uniform case, but I think that is much less common and raises some thorny design issues. Let me know what you think and if there's any support I can provide in moving toward the 1D RectLattice capability.
Hi @paulromano, I generally agree with your conclusion that extending We'll still need to figure out how to implement the 1D tiling structure without needing to define every region in space off to infinity within the pitch-defined bounds of the tile. I'll try to think about some good ways to do this. |
@yardasol have you thought more about a way to implement this? I recently built some serpent inputs using the stack lattice feature with variably spaced planes, and wow, it is so much more convenient than what has to be done in openmc at the moment. I guess it would be something like: RectLattice would look like the RectilinearMesh instead now, and save some 1D arrays of the X, Y, and Z values the planes are defined at. I think it's a computationally negligible part of the code, so the extra work to look up into those (usually fitting in the cache) vectors would be pretty quick. Then only in the python side, we could implement ZStack, YStack, etc as shorthand ways to define a RectLattice with the expected syntax. |
This PR adds a new type of
Lattice
,StackLattice
, meant to simplify the creation of universes repeated in one dimenson.Specifically this PR:
lattice.py
:StackLattice
classStackLattice
as one of the possible classes inLattice.from_hdf5
geometry.py
StackLattice
ingeometry.py::from_xml
include/openmc/lattice.h
StackLattice
src/lattice.cpp
StackLattice
(WIP)src/geometry.cpp
StackLattice
case to theswitch
statement indistance_to_boundary
write_bool
inhdf5_interface.cpp
andhdf5_interface.h
tests/
slat_u
andslat_nu
objects, associated lines in test functions tounit_tests/test_lattice.py
stack_lat
regression test toregression_tests
. The tests cover both uniform and non-uniform stack latticesThis PR also adds a section on Stack Lattices to the User's Guide, a section on StackLattice tiling to the Theory Manual, as well as a reference to
StackLattice
in the Python API docs.I tried my best on the C++ side but I'm much less familiar with that area of OpenMC (and rustier on my C++), so I'm sure there are some things I did inefficiently.